from langchain_openai import ChatOpenAI
from langchain_core.prompts import PromptTemplate
from langchain.chains.llm import LLMChain
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate

api_key = "sk-6S0PtpNia71gjcfwSsDPsJ9mGqsVPr2XRQzAx1dHbJS7RW4t"
api_base="https://chatapi.littlewheat.com/v1"

prompt_template = ChatPromptTemplate.from_messages([
    ("human","Tell me a {adjective} joke")
])

llm = ChatOpenAI(model="gpt-3.5-turbo",api_key=api_key ,base_url=api_base)



chain=LLMChain(llm=llm,prompt_template=prompt_template)
res=chain.invoke({"adjective":"上班"})
print(res)